package com.hontech.libratest.model

import com.hontech.libratest.env.DeviceEvent
import com.hontech.libratest.utils.*

class DeviceStatus(
    val appVersion: UInt16,
    val sw2: UInt32,
    val temp: UInt8,
    val ch12: UInt16,
    val ch13: UInt16,
    val pushMotor: UInt8,
    val elevator: UInt8
) {

    companion object {

        val instance =
            DeviceStatus(UInt16(), UInt32(), UInt8(), UInt16(), UInt16(), UInt8(), UInt8())

        fun recv(frame: Frame) {
            frame.parse(
                arrayOf(
                    instance.appVersion,
                    instance.sw2,
                    instance.temp,
                    instance.ch12,
                    instance.ch13,
                    instance.pushMotor,
                    instance.elevator
                )
            )
            eventBus.post(DeviceEvent())
        }
    }
}